//
//  ByFoundApi.m
//  caipiao_ios
//
//  Created by mc on 2018/8/13.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByFoundApi.h"

@implementation ByFoundApi


//公告
+ (void)noticeSuccess:(void(^)(ByNetBaseResult *result))success
              failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    [self  get:@"/Found/notice?" params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
    
}

//玩法集合
+ (void)wanfajiheSuccess:(void(^)(ByNetBaseResult *result))success
                 failure:(void(^)(ByNetBaseResult *result))failure{
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    [self get:@"/Found/wanfajihe?" params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
    
}


//新闻资讯
+ (void)newsSuccess:(void(^)(ByNetBaseResult *result))success
            failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    [self get:@"/Found/news?" params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
}


//资讯详情
+ (void)newsInfo:(ByNetModel *)model
         success:(void(^)(ByNetBaseResult *result))success
         failure:(void(^)(ByNetBaseResult *result))failure{
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    [self get:[NSString stringWithFormat:@"/Found/newsinfo?article_id=%@",model.article_id ] params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
    
}


//活动中心
+ (void)huodongSuccess:(void(^)(ByNetBaseResult *result))success
               failure:(void(^)(ByNetBaseResult *result))failure{


// 拼接参数
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
[self get:@"/Found/huodong?" params:params success:^(id result) {
    
    ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
    result1.code = 0;
    result1.msg = @"获取成功";
    result1.data = result;
    if(success) {
        success(result1);
    }
} failure:^(NSError *error) {
    
    ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
    result.code = error.code;
    result.msg = error.domain;
    result.data = error.localizedDescription;
    if(failure) {
        failure(result);
    } else {
        
    }
    
}];

}

//公告详情
+ (void)noticeInfo:(ByNetModel *)model
           success:(void(^)(ByNetBaseResult *result))success
           failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    [self get:[NSString stringWithFormat:@"/Found/noticeinfo?article_id=%@",model.article_id ] params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
}


//活动中心详情
+ (void)huodongInfo:(ByNetModel *)model
            success:(void(^)(ByNetBaseResult *result))success
            failure:(void(^)(ByNetBaseResult *result))failure{
    
    
    // 拼接参数
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    if (model.article_id) {
        [params setObject:model.article_id forKey:@"article_id"];
    }
    [self get:[NSString stringWithFormat:@"/Found/huodonginfo?article_id=%@",model.article_id ] params:params success:^(id result) {
        
        ByNetBaseResult *result1 = [[ByNetBaseResult alloc] init];
        result1.code = 0;
        result1.msg = @"获取成功";
        result1.data = result;
        if(success) {
            success(result1);
        }
    } failure:^(NSError *error) {
        
        ByNetBaseResult *result = [[ByNetBaseResult alloc] init];
        result.code = error.code;
        result.msg = error.domain;
        result.data = error.localizedDescription;
        if(failure) {
            failure(result);
        } else {
            
        }
        
    }];
    
}


@end
